package com.zhentao.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import lombok.Data;

/**
 * 自动检控配置表：存储自定义检控规则，新数据入库时触发
 * @TableName monitor_rule
 */
@TableName(value ="monitor_rule")
@Data
public class MonitorRule implements Serializable {
    /**
     * 规则ID
     */
    @TableId(type = IdType.AUTO)
    private Integer id;

    /**
     * 检控规则名称
     */
    private String ruleName;

    /**
     * 规则类型：1-格式校验 2-逻辑校验
     */
    private Integer ruleType;

    /**
     * 规则表达式（如SQL条件、正则）
     */
    private String ruleExpression;

    /**
     * 适用关区
     */
    private String customsArea;

    /**
     * 状态：1-启用 2-停用
     */
    private Integer status;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        MonitorRule other = (MonitorRule) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getRuleName() == null ? other.getRuleName() == null : this.getRuleName().equals(other.getRuleName()))
            && (this.getRuleType() == null ? other.getRuleType() == null : this.getRuleType().equals(other.getRuleType()))
            && (this.getRuleExpression() == null ? other.getRuleExpression() == null : this.getRuleExpression().equals(other.getRuleExpression()))
            && (this.getCustomsArea() == null ? other.getCustomsArea() == null : this.getCustomsArea().equals(other.getCustomsArea()))
            && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getRuleName() == null) ? 0 : getRuleName().hashCode());
        result = prime * result + ((getRuleType() == null) ? 0 : getRuleType().hashCode());
        result = prime * result + ((getRuleExpression() == null) ? 0 : getRuleExpression().hashCode());
        result = prime * result + ((getCustomsArea() == null) ? 0 : getCustomsArea().hashCode());
        result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", ruleName=").append(ruleName);
        sb.append(", ruleType=").append(ruleType);
        sb.append(", ruleExpression=").append(ruleExpression);
        sb.append(", customsArea=").append(customsArea);
        sb.append(", status=").append(status);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}